package 传智播客_黑马.java高级.网络编程;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

class A {
    public A() throws IOException {
//        Socket socket = new Socket("192.168.204.128",6000);
        //建立连接
        Socket socket = new Socket("127.0.0.1",6000);

        //发送数据
        OutputStream outputStream = socket.getOutputStream();
        outputStream.write("Hello\ndfhoahgoihakfhakfahgf]\ndfghajgdfjad".getBytes());

        //关闭流、socket
        outputStream.close();
        socket.close();
    }

    public static void main(String[] args) throws IOException {
        new A();
    }
}
